import sys
import time
import subprocess


def main(sh):
    while 1:
        x = subprocess.run(f'sh {sh}', shell=True, stderr=subprocess.PIPE)
        if x.returncode == 0:
            break
        time.sleep(30)


if __name__ == "__main__":
    main(sys.argv[1])
